<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
</html>
<script src="node_modules/webviewbridgeclient/lib/index.js"></script>
<script>
    //DOM树加载
    function documentReady(fn) {
        if (document.addEventListener) document.addEventListener('DOMContentLoaded', fn, false);
        else {
            document.attachEvent('onreadystatechange', function () {
                //IE兼容
                if (document.readyState === 'complete') {
                    fn && fn();
                }
            });
        }
    }

    //设置页面初始度量值
    documentReady(function () {
        getBridge().then((bridge) => {
            // js 被原生调用
            bridge.registerHandler('nativeCallJs',(data,responseCallback)=>{
                console.log('消息',data);
                responseCallback(data);
            });
            // js调用原生
            bridge.callHandler('jsCallNative',{'key':'value'}).then(responseData=>{
                console.log('js received Native massage',responseData)
            })
        })
    })
</script>